package com.migo.api;

import org.springframework.web.bind.annotation.ModelAttribute;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Created by Wes on 2019/1/15.
 */

public class ApiBaseController {


    protected HttpServletRequest request;
    protected HttpServletResponse response;


    @ModelAttribute
    public void setReqAndResp(HttpServletRequest request, HttpServletResponse response){
//        this.request = request;
//        SysContent.setRequest(request);
//        SysContent.setResponse(response);
        this.response = response;
        this.response.setHeader("Access-Control-Allow-Origin", "*");
        this.response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
        this.response.setHeader("Access-Control-Max-Age", "3600");
        this.response.setHeader("Access-Control-Allow-Headers", "x-requested-with,Authorization");
        this.response.setHeader("Access-Control-Allow-Credentials", "true");
    }
}
